package com.zc.study.spring.第一章.spring1_2_4;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

/**
 * 利用配置appcontext.xml加spring 自动完成hellofactory的创建过程
 */
public class run {
    private static final Logger logger= LoggerFactory.getLogger(run.class);

    public run() {
        Resource resource = new ClassPathResource("study_spring/spring1/appcontext.xml");
        BeanFactory factory = new XmlBeanFactory(resource);
        Helloworld hw = (Helloworld) factory.getBean("fileHelloWorld");
        logger.debug(hw.getContent());
    }

    public static void main(String[] args) {
        new run();
    }
}
